home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
Audio dcmds
/
Audio CD dcmds.sit
/
Audio CD dcmds.π
/
Think Put Lib source
/
PutSDecTo.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-31
|
572b
|
32 lines
extern short __putMark;
void PutChar(char c);
void PutText(const char* s, int len );
void __DecToText (unsigned long dec, char* str );
void PutSpacesTo(int endpos);
void PutSDecTo(signed long i, int endpos)
{
Boolean isNeg;
int start, n = 0;
char* str = "0000000000";
if ( isNeg = ( i < 0 ) )
i = -i;
__DecToText (i, str );
while ( str[n] == '0' && n<9 )
n++;
start = endpos - (10-n);
if ( isNeg ) start--;
if ( start >= __putMark )
PutSpacesTo( start-1 );
PutChar( '#' );
if ( isNeg ) PutChar( '-' );
PutText( &str[n], 10-n );
}